package com.ls.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 积分记录
 * </p>
 *
 * @author pengyu
 * @since 2024-10-12
 */
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = false)
public class ScoreRecord extends Model<ScoreRecord> {
    private static final long serialVersionUID=1L;
    /**
     * 订单记录id
     */
    @TableId(value = "record_id", type = IdType.AUTO)
    private Long recordId;
    /**
     * 用户Id
     */
    private Long customerId;
    private Long orderRecordId;
    /**
     * 用户电话
     */
    private String phone;
    /**
     * 积分类型：1 每日登录 2 订单消费
     */
    private Long changeType;
    /**
     * 改变前的积分
     */
    private Long beforeScore;
    /**
     * 改变后的积分
     */
    private Long afterScore;
    /**
     * 改变的分数
     */
    private Long changeScore;
    /**
     * 积分改变的时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime recordTime;
    /**
     * 0为失效，1为正常
     */
    private Integer validFlag;
    @Override
    protected Serializable pkVal() {
        return this.recordId;
    }
}
